[3.0] Add check-update command and CheckUpdateInterface for artifacts#1044
[3.0] Add check-update command and CheckUpdateInterface for artifacts#1044crazywhalecc wants to merge 16 commits intov3-refactor/extensionsfrom
check-update command and CheckUpdateInterface for artifacts#1044Conversation
check-update command and CheckUpdateInterface for artifacts
There was a problem hiding this comment.
Pull request overview
Adds a new check-update CLI command plus a CheckUpdateInterface so artifact downloaders (and custom binaries via attributes) can report whether an update is available, using cached version metadata when present.
Changes:
- Introduce
check-updatecommand and plumbing inArtifactDownloaderto perform update checks. - Add
CheckUpdateInterface/CheckUpdateResultand implement update checking for multiple downloader types (git, ghrel, ghtar/ghtagtar, filelist, php-release, pie). - Persist downloader class metadata in download cache and add a new
#[CustomBinaryCheckUpdate]attribute for custom binary artifacts.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/StaticPHP/Registry/ArtifactLoader.php | Registers #[CustomBinaryCheckUpdate] callbacks during artifact loading. |
| src/StaticPHP/Exception/WrongUsageException.php | Attempts to mark exception as “simple output”. |
| src/StaticPHP/Exception/SPCException.php | Adds simple-output flag + getters/setters for exception handling. |
| src/StaticPHP/Exception/RegistryException.php | Attempts to mark exception as “simple output”. |
| src/StaticPHP/Exception/InterruptException.php | Attempts to mark exception as “simple output”. |
| src/StaticPHP/Exception/ExceptionHandler.php | Switches “minor log” behavior to per-exception isSimpleOutput(). |
| src/StaticPHP/ConsoleApplication.php | Registers the new check-update command. |
| src/StaticPHP/Command/CheckUpdateCommand.php | Implements check-update CLI command with JSON/bare options and --with-php. |
| src/StaticPHP/Attribute/Artifact/CustomBinaryCheckUpdate.php | New attribute to bind custom binary update-check callbacks. |
| src/StaticPHP/Artifact/Downloader/Type/Url.php | Tags download results with downloader class name. |
| src/StaticPHP/Artifact/Downloader/Type/PhpRelease.php | Implements CheckUpdateInterface for php.net releases and git mode. |
| src/StaticPHP/Artifact/Downloader/Type/PIE.php | Implements CheckUpdateInterface for Packagist “pie” artifacts. |
| src/StaticPHP/Artifact/Downloader/Type/LocalDir.php | Tags download results with downloader class name. |
| src/StaticPHP/Artifact/Downloader/Type/HostedPackageBin.php | Tags download results with downloader class name; minor instantiation tweak. |
| src/StaticPHP/Artifact/Downloader/Type/GitHubTarball.php | Implements CheckUpdateInterface for ghtar/ghtagtar and tags results with downloader. |
| src/StaticPHP/Artifact/Downloader/Type/GitHubRelease.php | Implements CheckUpdateInterface for ghrel and tags results with downloader. |
| src/StaticPHP/Artifact/Downloader/Type/Git.php | Implements CheckUpdateInterface; tags results with downloader; stores hash in version for rev. |
| src/StaticPHP/Artifact/Downloader/Type/FileList.php | Implements CheckUpdateInterface; refactors to share “latest version” fetch logic. |
| src/StaticPHP/Artifact/Downloader/Type/CheckUpdateResult.php | New DTO for update check results. |
| src/StaticPHP/Artifact/Downloader/Type/CheckUpdateInterface.php | New interface contract for update checking. |
| src/StaticPHP/Artifact/Downloader/Type/BitBucketTag.php | Tags download results with downloader class name. |
| src/StaticPHP/Artifact/Downloader/DownloadResult.php | Adds optional downloader field and threads it through factory methods. |
| src/StaticPHP/Artifact/ArtifactDownloader.php | Adds core checkUpdate() logic (cache-based + bare mode + custom callbacks). |
| src/StaticPHP/Artifact/ArtifactCache.php | Persists downloader metadata into .cache.json. |
| src/StaticPHP/Artifact/Artifact.php | Stores and resolves custom binary check-update callbacks per platform. |
| src/Package/Artifact/zig.php | Adds custom binary update check implementation via new attribute. |
| src/Package/Artifact/go_xcaddy.php | Adds custom binary update check implementation via new attribute. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/StaticPHP/Artifact/Downloader/Type/CheckUpdateInterface.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@henderkes I noticed this may be related to your pr #1011 . The update function and command looks good to implement after this PR merged, but I have a question for php-src's version selection. Considering our locking strategy for downloaded artifacts, I think it's not very appropriate to use a env-var to control source name. Either we split php-src to different artifact like |

What does this PR do?
This PR implements the
check-updatecommand and update check interfaces for several commonly used download types:filelist,git,ghrel,ghtar,ghtagtar,php-release, andpie.Note that
php-releasetype will return an update requirement when using--with-phpto specify different major versions.Closes #895
Checklist before merging
*.phpor*.json, run them locally to ensure your changes are valid:composer cs-fixcomposer analysecomposer testbin/spc dev:sort-configsrc/globals/test-extensions.php.extension testortest extensionsto trigger full test suite.